package com.redislock.aop.tool.bean;

import lombok.Data;

@Data
public class RedisLockDefinitionHolder {
    //唯一业务员
    private String businessKey;

    //加锁时间
    private Long lockTime;

    //上次更新时间
    private Long lastModifyTime;

    //保存当前线程
    private Thread currentThread;

    //总尝试次数
    private Long tryCount;

    //当前尝试次数
    private Long currentCount;

    //更新时间
    private Long modifyPeriod;

    public RedisLockDefinitionHolder(String businessKey, Long lockTime, Long lastModifyTime, Thread currentThread, Long tryCount) {
        this.businessKey = businessKey;
        this.lockTime = lockTime;
        this.lastModifyTime = lastModifyTime;
        this.currentThread = currentThread;
        this.tryCount = tryCount;
        this.currentCount=0L;
        //更新时间为：锁时间*1000再除以3就是更新时间
        this.modifyPeriod=(lockTime*1000)/3;
    }
}
